package com.threaddemo1;

public class YieldTest {
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            int finalI = i;
            Thread t = new Thread(new Runnable() {
                @Override
                public void run() {
                    if(finalI % 2 == 0){
                        Thread.currentThread().yield();
                    }
                    System.out.println("i = " + finalI);
                }
            });

            t.start();
        }
    }
}
